Skip to content

Compatibility with anndata 0.13 - #88

Merged
colganwi merged 2 commits into
mainfrom
fix/anndata-0.13-compat
Jul 8, 2026
Merged

Compatibility with anndata 0.13#88
colganwi merged 2 commits into
mainfrom
fix/anndata-0.13-compat

Conversation

@colganwi

@colganwi colganwi commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Makes treedata compatible with anndata 0.13.

  • Fix TreeData.__getitem__ for the new anndata.acc accessor. In 0.13, obs_vector/var_vector (and any var_names/layer column lookup) are reimplemented on top of the acc accessor: AnnData.obs_vector(k) builds an AdRef and calls adata[ref]. TreeData.__getitem__ overrode AnnData.__getitem__ and sent the AdRef straight into _normalize_indices, raising IndexError: Unknown indexer A.X[:, '1']. It now delegates accessor-type indexers (AdRef, MapAcc, RefAcc) to AnnData.__getitem__ (which returns the array/vector) and only builds a TreeData view for real index slices.
  • Raise the dependency floors: anndata>=0.13 (which requires Python >=3.12) and zarr>=3 (anndata 0.13 dropped zarr <3 support).
  • Remove now-dead version-gated branches: the anndata<0.11 (USE_EXPERIMENTAL) paths in read.py/write.py and the zarr<3 (ZARR_V2) paths in write.py, along with their unused imports.

Verification

Full suite (58 tests) passes on both:

  • anndata 0.12.16 / zarr 3.1.3 (pre-bump baseline)
  • anndata 0.13.0 / zarr 3.2.1 / Python 3.12

Confirmed under 0.13 that obs_vector/var_vector (incl. layer=) return correct columns, normal slicing still returns a TreeData view, and zarr (incl. ZipStore + large-tree) and h5td backed/non-backed round-trips all pass.

I also reviewed the other 0.13 breaking changes (X→layers[None], zarr v3 autosharding default, backed sparse, __setitem__/__delitem__ removal, h5ad forward-slash keys, nullable strings) and confirmed treedata either already handles them or is unaffected — no further code changes were needed.

🤖 Generated with Claude Code

Delegate anndata.acc accessor indexers (AdRef, MapAcc, RefAcc) from
TreeData.__getitem__ to AnnData.__getitem__ instead of routing them
through _normalize_indices, fixing an "IndexError: Unknown indexer"
from obs_vector/var_vector under anndata >= 0.13.

Bump the floors to anndata>=0.13 and zarr>=3 (anndata 0.13 requires
Python >=3.12 and no longer supports zarr <3), and remove the now-dead
anndata<0.11 (USE_EXPERIMENTAL) and zarr<3 (ZARR_V2) code branches.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f0959ae12

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml
{ name = "William Colgan" },
]
requires-python = ">=3.11"
requires-python = ">=3.12"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove Python 3.11 from the test matrix

With this floor bump, the hatch matrix still contains Python 3.11 at pyproject.toml:78, and .github/workflows/test.yaml reads that matrix and creates every listed environment. That schedules a hatch-test job under Python 3.11 for each PR, but an editable install of this project is invalid once requires-python is >=3.12, so the required test workflow will fail before running tests. Please update the matrix's lowest Python to 3.12 or remove the 3.11 entry along with this change.

Useful? React with 👍 / 👎.

@colganwi
colganwi merged commit 7d49374 into main Jul 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant